Planetary-Specific Scripts
Specialized utilities for planetary science data processing, including slope analysis, coordinate system definitions, and format conversions.gdal_baseline_slope.py
Calculates slope from DEMs using specialized baseline lengths or Horn’s method.Usage
Parameters
Input DEM file
Output slope file (GeoTIFF)
Options
Baseline length in pixels for slope calculation. If not specified, uses Horn’s method (equivalent to gdaldem slope).
Output data type (default: same as input)Options:
Byte, Int16, UInt16, Int32, UInt32, Float32, Float64Crop output to remove edge effects from baseline calculation
Quiet mode - suppress progress output
Slope Calculation Methods
Horn’s Method (Default)
When-baseline is not specified:
- Uses 3x3 kernel (standard GIS slope calculation)
- Equivalent to
gdaldem slope - No shift in geotransform
Baseline Method
When-baseline N is specified:
- Uses corner points of N×N footprint
- Follows Kirk’s method for planetary analysis
- Even baselines shift geotransform by half pixel
Byte Output Scaling
When-ot Byte is used:
- Slopes are scaled to 1-255 range
- Formula:
DN = (slope + 0.2) × 5.0 - Slopes >50° map to 255
- NoData = 0
- Set offset = -0.2, scale = 0.2 in output
Example
Cropping Behavior
When-crop is used with -baseline:
| Baseline | Pixels Removed | Geotransform Shift |
|---|---|---|
| 1 | 1 (right/bottom) | +1 pixel X/Y |
| 2 | 1 (each edge) | +1 pixel X/Y |
| 5 | 2-3 (edges) | +3 pixels X/Y |
Requirements
create_IAU2000_wkt_v3.py
Generates OGC WKT (Well-Known Text) projection strings for IAU planetary coordinate systems.Usage
Parameters
Input CSV file with IAU body radiiMust be named:
naifcodes_radii_m_wAsteroids_IAU{YEAR}.csvSupported years: 2000, 2009, 2015Output WKT file (default: stdout)
Input CSV Format
Generated Coordinate Systems
For each body, generates multiple coordinate system definitions:Geographic Systems
- X00 - Planetocentric
- X01 - Planetographic
Static Projections
- X10-X13 - Equirectangular (ocentric/ographic, clon 0/180)
- X14-X17 - Sinusoidal (ocentric/ographic, clon 0/180)
- X18-X21 - Polar Stereographic (North/South, ocentric/ographic)
- X22-X29 - Mollweide and Robinson variants
AUTO Projections (Variable Center)
- X60-X61 - Sinusoidal AUTO
- X62-X63 - Stereographic AUTO
- X64-X65 - Transverse Mercator AUTO
- X66-X67 - Orthographic AUTO
- X68-X69 - Equirectangular AUTO
- X70-X71 - Lambert Conformal Conic AUTO
- X72-X73 - Lambert Azimuthal Equal Area AUTO
- X74-X75 - Mercator AUTO
- X76-X77 - Albers AUTO
- X78-X79 - Oblique Cylindrical Equal Area AUTO
- X80-X83 - Mollweide and Robinson AUTO
Example
Output Format
Use Cases
- Configuring WMS/WCS services for planetary data
- Creating custom projections for planetary mapping
- Supporting GDAL/MapServer planetary coordinate systems
- Generating ESRI .prj files for planetary data
IAU Reports Supported
- IAU 2000 - Seidelmann et al. (2002)
- IAU 2009 - Archinal et al. (2011)
- IAU 2015 - Archinal et al. (2018)
isis3_to_pds4_LOLA_pvl.py
Converts ISIS3 cube labels to PDS4 format using GDAL’s PDS4 driver.Usage
Parameters
Input ISIS3 cube file
Output GDAL configuration file for PDS4 conversion
Options
Automatically execute gdal_translate after creating config
Path to custom PDS4 XML templateDefault:
$GDALDATA/pds4_template.xmlHow It Works
- Reads ISIS3 label using Python PVL library
- Extracts metadata: target, mission, instrument, product ID
- Creates GDAL configuration file with PDS4 variables
- Optionally runs
gdal_translateto create PDS4 product
Output Files
Generated configuration file contains:Example
Manual Conversion
After creating config file:Requirements
fix_jp2_v2
Corrects GeoJP2 projection keywords for Equirectangular projections (C++ utility).Purpose
Fixes HiRISE and other JPEG2000 files whereCenterLatGeoKey was incorrectly used instead of StandardParallel1GeoKey in Equirectangular projections.
Usage
Parameters
Input/output JPEG2000 file to fix (modified in place)
How It Works
- Opens the JPEG2000 file
- Locates the GeoTIFF metadata section
- Changes
CenterLatGeoKeytag toStandardParallel1GeoKey - Writes changes (only a few bytes modified)
- Does not decompress/recompress imagery
Safety
Example
Compilation
Use Cases
- Fixing older HiRISE JPEG2000 files
- Correcting GeoJP2 files with incorrect projection parameters
- Batch processing of archived data
Technical Details
Addresses GDAL ticket: http://trac.osgeo.org/gdal/ticket/2706Common Workflows
Planetary Slope Analysis Workflow
PDS4 Archive Workflow
Requirements
All planetary scripts require:- Python 2.7+ or Python 3.x (varies by script)
- GDAL/OGR Python bindings
- Script-specific dependencies (NumPy, SciPy, pvl)